<template>
	<view class="contents" :style="'height:'+screenHeight+'px;'">
		<view class="" style="color: gray;">
			<span>可凭此二维码进行体检</span>
		</view>
		<view class="" style="width: 100%;display: flex;justify-content: center;">
				<view class="code">
					<uv-qrcode ref="qrcode" size="500rpx" :value="TJRegNo"></uv-qrcode>
					<view class="codetetx" style="padding-top: 30rpx;">
						<span>订单号：{{TJRegNo}}</span>
					</view>
					
				</view>
		</view>
	</view>
</template>

<script>
	import UQRCode from 'uqrcodejs';
	export default {
		data() {
			return {
				TJRegNo:'',
				showcode:false
				}
		},
		onLoad:function(option) {
			this.TJRegNo=option.TJRegNo
			this.canvas()
		},
		methods: {
			detil(e) {
				
				uni.navigateTo({
					url: `/pages/zhuyaun/charge/chargedetilmz?jzlsh=${e}`
				})
			},
			canvas() {
				// this.TJRegNo = TJRegNo
				this.couponQrCode()
			},
			couponQrCode() {
				// 获取uQRCode实例
				var qr = new UQRCode();
				// 设置二维码内容
				qr.data = this.TJRegNo;
				// 设置二维码大小，必须与canvas设置的宽高一致
				qr.size = 200;
				// 调用制作二维码方法
				qr.make();
				// 获取canvas上下文
				var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件，this必须传入
				// 设置uQRCode实例的canvas上下文
				qr.canvasContext = canvasContext;
				// 调用绘制方法将二维码图案绘制到canvas上
				qr.drawCanvas();
				this.showcode = true
			},
		}
	}
</script>

<style>
	@import './tijian.css';
</style>